package pl.edu.agh.sius.clients;

import javax.xml.ws.BindingProvider;

import pl.edu.agh.siusbox.wastetransport.schema.WasteTransportRequest;
import pl.edu.agh.siusbox.wastetransport.service.CanonicServiceForclient;
import pl.edu.agh.siusbox.wastetransport.service.Forclient;

/**
 * Hello world!
 *
 */
public class WasteTransportWSClient 
{
    public static void main( String[] args )
    {
       
    	Forclient fc=new CanonicServiceForclient().getCanonicPort();
    	WasteTransportRequest wsr=new WasteTransportRequest();
    	wsr.setFirstName("FirstName");
    	wsr.setSurname("Surname");
    	
    	wsr.setPesel("Pesel");
    	wsr.setAddress("Address");
    	wsr.setFinancialGuaranteesDocURL("http://www.onet.pl/");
    	wsr.setWasteTransportPermissionPetitionDocURL("http://www.onet.pl/");
    	fc.start(wsr);
    	//now check tasks tab on http://localhost:8080/ui-fw/  (use credentials:admin/changeit)
    	
    	System.out.println("works");
    	
    }
    
    
    public void invoke(WasteTransportRequest wsr, String ip) {
    	
    	Forclient fc = new CanonicServiceForclient().getCanonicPort();
		BindingProvider pb = ((BindingProvider) fc);
		pb
				.getRequestContext()
				.put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY,
						"http://" + ip + ":8080/ode/processes/ToxicWasteTransport/WasteTransport/wasteTransport/client");
		fc.start(wsr);
		System.out.println("works");
		
    }
    
}
